package com.javase.多线程.JUC三大辅助类;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @Auther: liyanhao
 * @Description: 使用ReentranReadWritteLock对一个hashmap进行读和写操作
 * @Date: 2022/5/14 20:20
 * @Version: v1.0
 */
public class MyCahche {
    private volatile Map<String, Object> caches = new HashMap<>();
    private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
    private ReentrantReadWriteLock.ReadLock readLock = lock.readLock();

    public static void main(String[] args) {

    }
}
 class MyRejectHandler implements RejectedExecutionHandler{

     @Override
     public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
         BlockingQueue<Runnable> queue = executor.getQueue();
     }
 }